//GKL replication

cd "/Users/spencergoidel/Dropbox/PartyPie/Data"

use "POQ_GKL_2021.dta", clear

tsset date


//Figure 1a: traditional macropartisanship
twoway line macrop date, lwidth(medthick) yscale(range(.4 .8)) ylabel(.4 (.1) .8, nogrid) ytitle("Proportion of partisan identifiers who are Democrats") xtitle("Quarter") graphregion(color(white) lwidth(large)) bgcolor(white) 


//Figure 1b: compositional macropartisanship
twoway (line rep date, lc(red) lpattern(longdash_dot) lwidth(medthick)) (line dem date, lc(ebblue) lpattern(shortdash) lwidth(medthick)) (line nonpartisan date, lc(black) lwidth(medthick)), yscale(range(.1 .5)) ylabel(.1 (.1) .5, nogrid) ytitle("Compositional") xtitle("Quarter") graphregion(color(white)) bgcolor(white) legend(rows(1) ring(0) position(8) bmargin(small))


//Figure 2a: the partisan effects of a 6.38% shock in approval
dynsimpie dem_csi dem_pres, dvs(nonpartisan rep dem) ar(1 2) shockvars(dem_approve) shockvals(6.379107)
effectsplot


//Figure 2b: the partisan effects of a 5.00% shock in consumer sentiment 
dynsimpie dem_approve dem_pres, dvs(nonpartisan rep dem) ar(1 2) shockvars(dem_csi) shockvals(4.998399)
effectsplot

